package controllers;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ManagedProperty;
import javax.faces.bean.SessionScoped;
import javax.faces.bean.ViewScoped;
import javax.faces.context.FacesContext;
import javax.servlet.http.HttpSession;

import modelo.Caracteristicaxsalon;
import modelo.Combobebidaxsalon;
import modelo.Menu;
import modelo.Salon;
import modelo.Servicioadicionalxsalon;
import services.CaracteristicaxSalonService;
import services.ComboBebidaXSalonService;
import services.MenuxSalonService;
import services.SalonService;
import services.SalonWebService;
import services.ServicioAdicionalXSalonService;

@ManagedBean
@ViewScoped
public class SalonWebBean implements Serializable{

	private static final long serialVersionUID = -4397595345026841356L;
	
	@ManagedProperty("#{caracteristicaxSalonService}")
    private CaracteristicaxSalonService serviceCaracteristicaxSalon;
	List<Caracteristicaxsalon> listaCaracteristicasxSalon = new ArrayList<Caracteristicaxsalon>();
	private Caracteristicaxsalon caracteristicaxsalonSelected=new Caracteristicaxsalon();
	
	@ManagedProperty("#{menuxSalonService}")
    private MenuxSalonService serviceMenuxSalon;
	List<Menu> listaMenusxSalon = new ArrayList<Menu>();
	private Menu menuxsalonSelected=new Menu();
	
	@ManagedProperty("#{comboBebidaXSalonService}")
    private ComboBebidaXSalonService serviceComboBebidaxSalon;
	List<Combobebidaxsalon> listaCombosBebidasxSalon = new ArrayList<Combobebidaxsalon>();
	private Combobebidaxsalon combobbebidaxsalonSelected=new Combobebidaxsalon();
	 
	@ManagedProperty("#{servicioAdicionalXSalonService}")
	private ServicioAdicionalXSalonService serviceServicioAdicionalxSalon;
	List<Servicioadicionalxsalon> listaServicioAdicionalxSalon;
	private Servicioadicionalxsalon servicioadicionalxsalonSelected=new Servicioadicionalxsalon();	

	@ManagedProperty("#{salonService}")
	private SalonService serviceSalon=new SalonService();
	private Salon salon=new Salon();
	private Salon salonSelected=new Salon();
	private List<Salon> listaSalones=new ArrayList<Salon>();
	
	@ManagedProperty("#{salonWebService}")
	private SalonWebService serviceWebSalon=new SalonWebService();
	
	Boolean usuarioRegistrado=new Boolean(true);
	private String mensaje= new String();
	
//	private Salon salon;

	public SalonWebBean() {
		super();
	}

	@PostConstruct
	private void init() {
		//serviceSalon.init();
//		listaTablaFiltrada=serviceSalon.getListaSalones();
	//	listaServicioAdicionalxSalon = new ArrayList<Servicioadicionalxsalon>();
	    listaSalones=serviceSalon.getListaSalones();
	}

	public CaracteristicaxSalonService getServiceCaracteristicaxSalon() {
		return serviceCaracteristicaxSalon;
	}

	public void setServiceCaracteristicaxSalon(
			CaracteristicaxSalonService serviceCaracteristicaxSalon) {
		this.serviceCaracteristicaxSalon = serviceCaracteristicaxSalon;
	}

	public List<Caracteristicaxsalon> getListaCaracteristicasxSalon() {
		return listaCaracteristicasxSalon;
	}

	public void setListaCaracteristicasxSalon(
			List<Caracteristicaxsalon> listaCaracteristicasxSalon) {
		this.listaCaracteristicasxSalon = listaCaracteristicasxSalon;
	}

	public Caracteristicaxsalon getCaracteristicaxsalonSelected() {
		return caracteristicaxsalonSelected;
	}

	public void setCaracteristicaxsalonSelected(
			Caracteristicaxsalon caracteristicaxsalonSelected) {
		this.caracteristicaxsalonSelected = caracteristicaxsalonSelected;
	}

	public SalonService getServiceSalon() {
		return serviceSalon;
	}

	public void setServiceSalon(SalonService serviceSalon) {
		this.serviceSalon = serviceSalon;
	}

	public Salon getSalon() {
		return salon;
	}

	public void setSalon(Salon salon) {
		this.salon = salon;
	}

	public ServicioAdicionalXSalonService getServiceServicioAdicionalxSalon() {
		return serviceServicioAdicionalxSalon;
	}

	public void setServiceServicioAdicionalxSalon(
			ServicioAdicionalXSalonService serviceServicioAdicionalxSalon) {
		this.serviceServicioAdicionalxSalon = serviceServicioAdicionalxSalon;
	}

	public List<Servicioadicionalxsalon> getListaServicioAdicionalxSalon() {
		return listaServicioAdicionalxSalon;
	}

	public void setListaServicioAdicionalxSalon(
			List<Servicioadicionalxsalon> listaServicioAdicionalxSalon) {
		this.listaServicioAdicionalxSalon = listaServicioAdicionalxSalon;
	}

	public Servicioadicionalxsalon getServicioadicionalxsalonSelected() {
		return servicioadicionalxsalonSelected;
	}

	public void setServicioadicionalxsalonSelected(
			Servicioadicionalxsalon servicioadicionalxsalonSelected) {
		this.servicioadicionalxsalonSelected = servicioadicionalxsalonSelected;
	}


	public List<Salon> getListaSalones() {
		return listaSalones;
	}

	public void setListaSalones(List<Salon> listaSalones) {
		this.listaSalones = listaSalones;
	}

	public Salon getSalonSelected() {
		return salonSelected;
	}

	public void setSalonSelected(Salon salonSelected) {
		this.salonSelected = salonSelected;
	}

	public MenuxSalonService getServiceMenuxSalon() {
		return serviceMenuxSalon;
	}

	public void setServiceMenuxSalon(MenuxSalonService serviceMenuxSalon) {
		this.serviceMenuxSalon = serviceMenuxSalon;
	}

	public List<Menu> getListaMenusxSalon() {
		return listaMenusxSalon;
	}

	public void setListaMenusxSalon(List<Menu> listaMenusxSalon) {
		this.listaMenusxSalon = listaMenusxSalon;
	}

	public Menu getMenuxsalonSelected() {
		return menuxsalonSelected;
	}

	public void setMenuxsalonSelected(Menu menuxsalonSelected) {
		this.menuxsalonSelected = menuxsalonSelected;
	}
	
		
	public ComboBebidaXSalonService getServiceComboBebidaxSalon() {
		return serviceComboBebidaxSalon;
	}

	public void setServiceComboBebidaxSalon(
			ComboBebidaXSalonService serviceComboBebidaxSalon) {
		this.serviceComboBebidaxSalon = serviceComboBebidaxSalon;
	}

	public List<Combobebidaxsalon> getListaCombosBebidasxSalon() {
		return listaCombosBebidasxSalon;
	}

	public void setListaCombosBebidasxSalon(
			List<Combobebidaxsalon> listaCombosBebidasxSalon) {
		this.listaCombosBebidasxSalon = listaCombosBebidasxSalon;
	}

	public Combobebidaxsalon getCombobbebidaxsalonSelected() {
		return combobbebidaxsalonSelected;
	}

	public void setCombobbebidaxsalonSelected(
			Combobebidaxsalon combobbebidaxsalonSelected) {
		this.combobbebidaxsalonSelected = combobbebidaxsalonSelected;
	}
	
	

	public SalonWebService getServiceWebSalon() {
		return serviceWebSalon;
	}

	public void setServiceWebSalon(SalonWebService serviceWebSalon) {
		this.serviceWebSalon = serviceWebSalon;
	}

	public void llenarTablaMenus(){
		listaMenusxSalon = serviceMenuxSalon.obtenerMenuxSalon(salonSelected.getIdSalon());
	}
	
	public void llenarTablaServicios(){
		listaServicioAdicionalxSalon = serviceServicioAdicionalxSalon.obtenerServicioAdicionalxSalon(salonSelected.getIdSalon());
	}
	
	public void llenarTablaCaracteristicas(){
		listaCaracteristicasxSalon = serviceCaracteristicaxSalon.obtenerCaracteristicasxSalon(salonSelected.getIdSalon());
	}
	
	public void llenarTablaBebidas(){
		listaCombosBebidasxSalon = serviceComboBebidaxSalon.obtenerCaracteristicasxSalon(salonSelected.getIdSalon());
	}
	

	public void registrarCita(){

        	serviceWebSalon.registrarCita(salonSelected.getIdSalon());
            
	}
	
	public void MostrarOcultarBotones(){
		
		if(usuarioRegistrado==true)
			usuarioRegistrado=false;
		else
			usuarioRegistrado=true;
	}

	public String getMensaje() {
		return mensaje;
	}

	public void setMensaje(String mensaje) {
		this.mensaje = mensaje;
	}
	
	}
